package cdu.dx.service.impl;

import cdu.dx.dao.UserDao;
import cdu.dx.model.User;
import cdu.dx.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: Java框架实验
 * @description:
 * @author: hanabi
 * @create: 2022-03-09 09:53
 **/
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;

    @Override
    public List<User> findAll() {
        return userDao.findAll();
    }

    @Override
    public User findById(int id) {
        return userDao.findById(id);
    }

    @Override
    public boolean add(User user) {
        return userDao.add(user) == 1;
    }

    @Override
    public boolean mod(User newUser) {
        return userDao.mod(newUser) == 1;
    }

    @Override
    public boolean del(int id) {
        return userDao.del(id) == 1;
    }
}
